package top.xchch.tool.mockito.juejin;

import static org.mockito.Mockito.*;

import java.util.List;

import org.junit.Test;

/**
 * 查找是否有未验证的交互
 * 不建议使用
 */
public class FindingRedundantInvocationsTest08 {
    @Test
    public void testFindingRedundantInvocations() throws Exception {
        List mockedList = mock(List.class);
        //using mocks
        mockedList.add("one");
        mockedList.add("two");

        verify(mockedList).add("one");

        //验证失败，因为mockedList.add("two")尚未验证
        verifyNoMoreInteractions(mockedList);
    }

}
